package ricky.utils
{
	import flash.utils.Dictionary;
	
	/**
	 * 字典类
	 */
	public  dynamic  class RDictionary extends Dictionary
	{
		public function RDictionary(weakKeys:Boolean=false)
		{
			super(weakKeys);
		}
		
		/**
		 * 得到缓存的数量
		 */
		public  function get size():uint
		{
			var re:uint=0;
			for(var i:* in this)
				re++;
			return re;
		}
		
		/**
		 * 清除当前key缓存
		 */
		public  function remove(key:String):void
		{
			this[key]=null;
			delete this[key];
		}
		
		/**
		 * 得到值
		 */
		public function getValue(key:String):*
		{
			return this[key];
		}
		
		/**
		 * 添加键值
		 */
		public function add(key:*,value:*):void
		{
			this[key]=value;
		}
		/**
		 * 清楚数据
		 */
		public function clear():void
		{
			//this=new Dictionary();
			for(var i:* in this)
				delete this[i];
		}
	}
}